﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Web Camera</title>
	<link rel="stylesheet" href="jquery/css/jquery.ui.all.css" />
	<link rel="stylesheet" href="css/common.css" />
	<script src="jquery/jquery-1.9.1.min.js"></script>
	<script src="jquery/jquery.ui.core.js"></script>
	<script src="jquery/jquery.ui.widget.js"></script>
	<script src="jquery/jquery.ui.mouse.js"></script>
	<script src="jquery/jquery.ui.slider.js"></script>
	<script src="jquery/json2.js"></script>
	<script src="js/network.js"></script>
	<script src="js/common.js"></script>
</head>
<script  type="text/javascript"> 
//语言包初始化
document.write(GetLanguagePathStr());
</script>
<style type="text/css">
.EmailDiv{
	background:#1c1d22;
	left:0px;
	right:0px;
	height:545px;
}

.DivLable{
	text-align:left;
	line-height: 23px;
	font-family:arial;
	font-style:regular;
	font-size:16px;
	color:#ffffff;
	height:23px;
	cursor: pointer;
}


.DivInputAtLoacalRecord{
	width:280px;
	float:left;
}

#id_txtLocalrecordpath{
	width:160px;
	float:left;
}

.txtEmailSetPage{
	width:160px;
	float:left;
}


</style> 



<body>   
<div class="EmailDiv"  style="min-width:600px;">
	<div style="height:100%;margin:auto;width:600px;">
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivCheckBox" style="float:left;" id="id_EmailEnable"><script>InitCheckBox('id_EmailEnable','flase')</script></div>
		<div class="DivLable" style="float:left;margin-left:10px;" id="id_txtEmailEnable">Enable</div>
		<div style="clear:both;height:15px;"></div>
		
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageMotionSub">Motion Subject:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_MotionSubject"value="admin" ></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageAlarmSub">Alarm Subject:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_AlarmSubject"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageSMTPServer">SMTP Server:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_SmtpServer"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageSMTPPort">SMTP Port:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_SmtpPort"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageUserName">EmailUserName:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailUserName"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPagePassword" >EmailPassword:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailPassword"value="admin" type="password"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageSender">EmailSender:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailSender"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageReceiver1">EmailReceiver:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailReceiver1"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageReceiver2">EmailReceiver:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailReceiver2"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageReceiver3">EmailReceiver:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailReceiver3"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivLable txtEmailSetPage" id="id_txtEmailSetPageReceiver4">EmailReceiver:</div>
		<input class="DivInput DivInputAtLoacalRecord" id="id_EmailReceiver4"value="admin"></input>
		
		<div style="clear:both;height:15px;"></div>
		<div class="DivButton" style="float:left;margin-left:300px;" id="id_submit">Save</div>
		<div style="clear:both"></div>
	</div>
</div>
</body>

<script  type="text/javascript"> 
//语言包初始化
function InitLang(){
	SetLang('id_txtEmailEnable',str_EmailEnable);
	SetLang('id_txtEmailSetPageMotionSub',str_EmailMotionTittle);
	SetLang('id_txtEmailSetPageAlarmSub',str_EmailAlarmTittle);	
	SetLang('id_txtEmailSetPageSMTPServer',str_SMTPserver);
	SetLang('id_txtEmailSetPageSMTPPort',str_SMTPPort);
	SetLang('id_txtEmailSetPageUserName',str_EmailUserName);
	SetLang('id_txtEmailSetPagePassword',str_EmailPwd);
	SetLang('id_txtEmailSetPageSender',str_SendEmail);
	SetLang('id_txtEmailSetPageReceiver1',str_PickUpEmail1);
	SetLang('id_txtEmailSetPageReceiver2',str_PickUpEmail2);
	SetLang('id_txtEmailSetPageReceiver3',str_PickUpEmail3);
	SetLang('id_txtEmailSetPageReceiver4',str_PickUpEmail4);
	SetLang('id_submit',str_EmailBtn);
}
</script> 

<script  type="text/javascript"> 
function InitPageParam()
{
	var resp = $.sendMsg("EmailStatus",null,"/ISAPI/Network/Email","POST");
	if(resp.success == false){
		alert("recv EmailStatus msg fail");
		return;
	}
	var map = resp.data;
	<!-- console.log( JSON.stringify(map)); -->
	SetCheckBox('id_EmailEnable',TranslationStrAndBool(map.enabled));
	$("#id_MotionSubject")[0].value = map.subjectalarm;
	$("#id_AlarmSubject")[0].value = map.alarmsensor;
	$("#id_SmtpServer")[0].value = map.smtpserver;
	$("#id_SmtpPort")[0].value = map.smtpport;
	$("#id_EmailUserName")[0].value = map.smtpuser;
	$("#id_EmailPassword")[0].value = map.smtppass;
	$("#id_EmailSender")[0].value = map.sender;
	$("#id_EmailReceiver1")[0].value = map.receiver_1;
	$("#id_EmailReceiver2")[0].value = map.receiver_2;
	$("#id_EmailReceiver3")[0].value = map.receiver_3;
	$("#id_EmailReceiver4")[0].value = map.receiver_4;
}

function submit()
{	
	var str_idEmailEnable;
	if(GetCheckBoxValue('id_EmailEnable') == "false"){
		str_idEmailEnable = "0";
	}else{
		str_idEmailEnable = "1";
	}
	
	var msg = [
				{"xtype":"enabled","text":str_idEmailEnable},
				{"xtype":"subjectalarm","text":$("#id_MotionSubject")[0].value},
				{"xtype":"alarmsensor","text":$("#id_AlarmSubject")[0].value},
				{"xtype":"smtpserver","text":$("#id_SmtpServer")[0].value},
				{"xtype":"smtpuser","text":$("#id_EmailUserName")[0].value},
				{"xtype":"smtppass","text":$("#id_EmailPassword")[0].value},
				{"xtype":"sender","text":$("#id_EmailSender")[0].value},
				{"xtype":"receiver_1","text":$("#id_EmailReceiver1")[0].value},
				{"xtype":"receiver_2","text":$("#id_EmailReceiver2")[0].value},
				{"xtype":"receiver_3","text":$("#id_EmailReceiver3")[0].value},
				{"xtype":"receiver_4","text":$("#id_EmailReceiver4")[0].value},
				{"xtype":"smtpport","text":$("#id_SmtpPort")[0].value}
			];
	
	var resp = $.sendMsg("EmailStatus",msg,"/ISAPI/Network/Email","PUT");
	<!--console.log(JSON.stringify(msg)); -->
	if(resp.success == false){
		alert("submit submit msg fail");
	}else{
		alert(str_SetSuccess);
	}
}

$(function(){	
	InitLang();
	InitPageParam();
	BindEvent('id_submit','onmousedown',submit,null);
})
</script>    
</html>  